import request from '../utils/request.js'

/**
 * 注册、登录相关API
 */
export default {
    /**
     * 发送验证码
     */
    sendSmsCode: (contact) => {
        // return request.get(`/auth/code/sms?contact=${contact}`)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    }
    /**
     * 验证验证码
     * @param code
     * @returns {Promise | Promise<unknown>}
     */
    , validSmsCode: (code) => {
        // return request.get(`/code/valid?code=${code}`)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    }

    /**注册*/
    , signUp: (data) => {
        return request.post("/user/register", data)
    }

    /**username登录*/
    , logIn: (username, password, code = "") => {
        // console.debug(`>>> request login .. username=${username} ; password = ${password}`)
        return request.post_form(`/login`, {username, password})
    }
    /**退出登录 */
    , logOut: () => {
        return request.post("/logout")
    }
    , checkingAuth: () => {
        return request.get("/auth/checking");
    },

    /**
     * 更改密码
     * @param id
     * @param params
     * @returns {Promise | Promise<unknown>}
     */
    editPassword: (id, params) => {
        // return request.put(`/user/password/${id}`, params)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    },
    /**
     * 更改头像
     * @param username
     * @param params
     * @returns {Promise<unknown>}
     */
    editAvatarUrl: (username, params) => {
        // return request.put(`/user/avatarUrl/${username}`, params)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    },
    /**
     * 更换手机号
     * @param id
     * @param params
     * @returns {Promise | Promise<unknown>}
     */
    editPhone: (id, params) => {
        // return request.put(`/user/phone/${id}`, params)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    },
    /**
     * 更换邮箱号
     * @param id
     * @param params
     * @returns {Promise | Promise<unknown>}
     */
    editEmail: (id, params) => {
        // return request.put(`/user/email/${id}`, params)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    },
    /**
     * 更改个性签名
     * @param id
     * @param params
     * @returns {Promise | Promise<unknown>}
     */
    editProfile: (id, params) => {
        // return request.put(`/user/profile/${id}`, params)
        return new Promise((resolve, reject) => {
            resolve({
                ok: true,
                msg: "",
                data: null
            })
        });
    }


}
